home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
g_quake
/
homefix.zip
/
HOMING.QC
< prev
next >
Wrap
Text File
|
1996-11-11
|
4KB
|
174 lines
//====================================================================
//
// Selected Homing by Lee Murdock lng@isat.com
// Alternate W_FireRocket by Vhold@netwizards.net
//
//====================================================================
// Aside from this new file, the following are the modifications
// done to id's original source files:
//--------------------------------------------------------------------
// File: Progs.src
// Location: before the "weapons.qc" line
// Added: homing.qc
//--------------------------------------------------------------------
// File: Weapons.qc
// Procedure: ImpulseCommands
// Location: in the function
// Added:
// if (self.impulse == 40)
// ActivateHoming ();
// if (self.impulse == 41)
// DeativateHoming ();
// Note: Use an alias to bind these two impulses to one Key.
//--------------------------------------------------------------------
// File: Defs.qc
// Declaration group: player only fields
// Location: after line ".float pain_finished;"
// Added: .float homing;
//--------------------------------------------------------------------
// File: Weapons.qc
// Procedure: W_FireRocket
// Location: after W_FireRocket
/*
================
W_FireHomingRocket
================
*/
/*
void() HomeThink;
entity() HomeFindTarget;
float(entity targ) visible;
float(entity targ) infront;
void() W_FireHomingRocket =
{
local entity missile, mpuff;
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
self.punchangle_x = -2;
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_FLYMISSILE;
missile.solid = SOLID_BBOX;
// set missile speed
makevectors (self.v_angle);
missile.velocity = aim(self, 1000);
missile.velocity = missile.velocity * 300;
missile.angles = vectoangles(missile.velocity);
missile.touch = T_MissileTouch;
missile.nextthink = time + 0.2;
missile.think = HomeThink;
missile.enemy = world;
setmodel (missile, "progs/missile.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + v_forward*8 + '0 0 16');
};
entity() HomeFindTarget =
{
local entity head, selected;
local float dist;
dist = 100000;
selected = world;
head = findradius(self.origin, 100000);
while(head)
{
if( (head.health > 1) && (head != self) && (head != self.owner) )
{
traceline(self.origin,head.origin,TRUE,self);
if ( (trace_fraction >= 1) && (vlen(head.origin - self.origin) < dist) )
{
selected = head;
dist = vlen(head.origin - self.origin);
}
}
head = head.chain;
}
if (selected != world)
{
sprint (self.owner,"Homing->");
if (selected.classname == "player")
{
sprint (self.owner,selected.netname);
sprint (selected,self.owner.netname);
sprint (selected," has a bogey on you!\n");
}
else
sprint (self.owner,selected.classname);
sprint (self.owner,"\n");
}
return selected;
};
void() HomeThink =
{
local vector dir, vtemp;
if ( !(self.enemy) || (self.enemy == world) || (self.enemy.health < 1) )
self.enemy = HomeFindTarget();
if (self.enemy != world) // Arr.. don't be taken on da World!
{
vtemp = self.enemy.origin + '0 0 10';
dir = normalize(vtemp - self.origin);
self.velocity = dir * 250;
self.angles = vectoangles(self.velocity);
}
self.nextthink = time + 0.2;
self.think=HomeThink;
};
*/
// ---------------------------------------------------------------------
// File: Weapons.qc
// Procedure: W_Attack
// Location: see below
/*
else if (self.weapon == IT_ROCKET_LAUNCHER)
{
player_rocket1();
CheckHomingRocket(); //replace W_FireRocket with this
self.attack_finished = time + 0.8;
}
*/
// ---------------------------------------------------------------------
//BEGIN HOMING.qc
void () W_FireHomingRocket;
void () W_FireRocket;
float HOMING_ON = 1; //bit flag
float HOMING_OFF = 2; //bit flag
//Activate Homing Rockets
void () ActivateHoming =
{
if (deathmatch || coop) //No more cheese!
return;
self.homing = HOMING_ON;
return;
};
//Deactivate Homing Rockets
void () DeactivateHoming =
{
self.homing = HOMING_OFF;
return;
};
//Check to see if Homing is activated
void () CheckHomingRocket =
{
if (self.homing == HOMING_ON)
W_FireHomingRocket ();
else if (self.homing == HOMING_OFF)
W_FireRocket ();
};